<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">
	</head>
	<body style="padding: 0px;">
		<div class="easyui-layout" style="width:100%;height:550px;">
			<div id="div_search" data-options="region:'north'" style="height:90px;">
			</div>
			<div data-options="region:'center'">
				<div id="p" class="easyui-panel" style="width:100%;height:100%;padding:0px;">
					<div>
						<table id="dg" style="width: 100%;" class="table_style">
						</table>
					</div>
					<div id="toolbar"></div>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
	<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../../../JS/common.js"></script>
	<script type="text/javascript" src="../../../JS/LogisticsShareFunction/SearchShareFunction.js"></script>
	<script type="text/javascript">
		var searchType = SEARCH_DISTRIBUTION_DATE_START +SEARCH_DISTRIBUTION_DATE_END+SEARCH_CUSTOMER_NAME;
		var content = buildSearchOptions(searchType, "");
		$("#div_search").append(content);

		function doSearch() {
			var searchCondition = processSearchCondition();
			var _url = RemoteLinkAddress + '/logistics/statistics/receivebycustomer?' + searchCondition;
			$('#dg').datagrid('options').url = _url;
			$('#dg').datagrid('reload');
		}
		
		function exportExcel()
		{
			var searchCondition = processSearchCondition();
			$.messager.confirm("提示", "确认导出Excel表格吗？", function(r) {
				if(r) {
					$.ajax({ //调用ajax方法，从服务器获取到该订单的所有数据
						type: "get",
						dataType: "json", //服务器返回的数据类型
						url: RemoteLinkAddress + "/logistics/statistics/receivebycustomer/excel.do?"+searchCondition,
						success: function(result) {
							window.location.href = result.path;
						}, //请求成功后，接受服务器传来的Json字符串，并做相应的处理
						error: function(xhr, status, error) {
							$.messager.alert("错误", "请求失败!");
						}
					});
				}
			});
		}

		content = AddReceiptsToolBar(1024, ""); /**根据用户的权限，来决定生成ToolBar的哪些功能**/
		$("#toolbar").append(content); /*在ID=toolbar的标记后面添加content中的内容*/
		$('#dg').datagrid({
			url: RemoteLinkAddress + '/logistics/statistics/receivebycustomer',
			toolbar: '#toolbar',
			method: 'get',
			rownumbers: 'true',
			autoRowHeight: 'true',
			fitColumns: 'false',
			singleSelect: 'true',
			height: 350,
			/*表格中的列名以及各自列名的ID*/
			columns: [
				[{
					field: 'CUSTOMER_NAME',
					title: '配送单位',
					width: '20%',
					align: 'center',
				}, {
					field: 'LUMP_SUM',
					title: '订货总计（元）',
					width: '15%',
					align: 'center',
				},
				 {
					field: 'FINALSUM',
					title: '收货总计（元）',
					width: '15%',
					align: 'center',
				},]
			],
		});
	</script>

</html>